<?php
$user = $_POST['userR'];
$pass = $_POST['passwordR'];
$name = $_POST['nameR'];
$day = $_POST['dayR'];
$month = $_POST['monthR'];
$year = $_POST['yearR'];
$email = $_POST['emailR'];
$country = $_POST['countryR'];
$webp = $_POST['webpR'];
$pic = $_POST['picR'];


$hostDB = "localhost";
$userDB = "ampersand";
$passDB = "palomitas";
$dbnameDB = "LYONUNO";

$canalDB = mysql_connect($hostDB, $userDB, $passDB);
$db = mysql_select_db($dbnameDB);
$sentencia = "INSERT INTO USERS values('{$user}','{$pass}','{$name}','{$year}-{$month}-{$day}','{$email}','{$country}','{$webp}','{$pic}',0,0)";

$res = mysql_db_query($dbnameDB, $sentencia,$canalDB);

mysql_db_query($dbnameDB, "commit",$canalDB);
mysql_close($canalDB);

if ($res == 1){
	setCookie("loggedIn","$user",(time()+(60*60*24)));
	header('Location: /main.php');
} else
	header('Location: /main.php?page=existingUser.html');
?>

